# Copyright© 2021 谈翰文
#
#         This program is free software: you can redistribute it and/or modify
#         it under the terms of the GNU General Public License as published by
#         the Free Software Foundation, either version 3 of the License, or
#         (at your option) any later version.
#
#         This program is distributed in the hope that it will be useful,
#         but WITHOUT ANY WARRANTY; without even the implied warranty of
#         MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#         GNU General Public License for more details.
#
#         You should have received a copy of the GNU General Public License
#         along with this program.  If not, see <https://www.gnu.org/licenses/>.
import sqlite3

conn = sqlite3.connect('bikesys.db')

print("数据库打开成功")
c = conn.cursor()
# 各车收入情况
c.execute('''CREATE TABLE BIKE_INCOME
       (ID INT PRIMARY KEY     NOT NULL,
       SALARY         REAL);''')
# 用户信息
c.execute('''CREATE TABLE CUSTOMER_INFO
       (ID INT PRIMARY KEY     NOT NULL,
       NAME           TEXT    NOT NULL,
       AGE            INT     NOT NULL,
       ADDRESS        CHAR(50));''')
# 车状态
c.execute('''CREATE TABLE BIKE_STATE
       (ID INT PRIMARY KEY     NOT NULL,
       STATE           TEXT    NOT NULL);''')
# 车定位
c.execute('''CREATE TABLE BIKE_LOC
       (ID INT PRIMARY KEY     NOT NULL,
       ADDRESS        CHAR(50));''')
# 区域收入记录
c.execute('''CREATE TABLE LOC_INCOME
       (ADDRESS CHAR(50) PRIMARY KEY NOT NULL,
       SALARY         REAL);''')
print("数据表创建成功")
conn.commit()
conn.close()
